﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="AddAgentQlty.aspx.cs" Inherits="IHISCETeim.Web.AgentSys.SvrMgr.AddAgentQlty"%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>经销商填写品情单</title>
    <style type="text/css">
        .mytable td.x-table-layout-cell {
            padding:0px 5px;
        }
 
        .mytable td.f-layout-table-cell {
            padding:0px 5px;
        }      
    </style>    
    <link rel="stylesheet" href="../res/css/jquery-ui-1.9.2.custom.min.css" />
</head>
<body>
    <form id="form1" runat="server">
    <f:PageManager ID="PageManager1" AutoSizePanelID="AddAgentQltyPanel" runat="server" />
    <f:Panel runat="server" ID="AddAgentQltyPanel"  ShowBorder="false" ShowHeader="false" Layout="Absolute" AutoScroll="true" >
        <Toolbars>
            <f:Toolbar ID="Toolbar1" runat="server" Position="Bottom" >
                <Items>
                    <f:ToolbarFill runat="server"></f:ToolbarFill>
                    <f:Button ID="btnClose" Icon="SystemClose" EnablePostBack="false" runat="server" Text="关闭"></f:Button>
                    <f:ToolbarSeparator ID="ToolbarSeparator2" runat="server"></f:ToolbarSeparator>
                    <f:Button ID="btnSaveClose" ValidateForms="AddAgentQltyForm" Icon="SystemSaveClose" runat="server" Text="新增后关闭" OnClick="btnSaveClose_Click" >
                    </f:Button>
                    </Items>
                </f:Toolbar>
        </Toolbars>
        <Items>
            <f:Form ID="AddAgentQltyForm" ShowBorder="false" ShowHeader="false" runat="server"  BodyPadding="5px" BoxConfigChildMargin="5px" Title="SimpleForm" >               
                <Items>
                    <f:Panel runat="server" ShowBorder="false" ShowHeader="false" BodyPadding="5px" Layout="HBox"  BoxConfigPosition="Right">
                        <Items> 
                            <f:TextBox runat="server" ID="TextBox1" Label="品情号" Readonly="true"  EmptyText="自动生成" ></f:TextBox>
                            <f:DatePicker runat="server" ID="IssueDate" Label="发行日期"  Required="true" ShowRedStar="true"></f:DatePicker>
                        </Items>                    
                    </f:Panel>
                    <f:Panel runat="server" ID="pnlMacInfo"   Title="1.机器资料" BodyPadding="5px" EnableCollapse="true" BoxConfigAlign="Stretch" Layout="HBox"  ShowHeader="true" ShowBorder="true">
                        <Items>                            
                            <f:Panel runat="server" ID="Panel1" ShowBorder="false" ShowHeader="false" Width="600px" Layout="Table"  TableConfigColumns="2" >
                                <Items> 
                                    <f:Label runat="server" ID="SvrInfo" TableColspan="2" Label="服务担当："></f:Label>  
                                    <f:TextBox runat="server" ID="AgentName" Label="经销商" Readonly="true"  Required="true" ShowRedStar="true" Text=""></f:TextBox>
                                    <f:TextBox runat="server" ID="SerialNumber" Label="机号"  Required="true" ShowRedStar="true" Text="" EnableBlurEvent="true" OnBlur="SerialNumber_Blur" AutoPostBack="false" ></f:TextBox>
                                    <f:TextBox runat="server" ID="CustomerName" Label="用户"  Required="true" ShowRedStar="true" Text=""></f:TextBox>
                                    <f:TextBox runat="server" ID="CustomerMobile" Label="用户手机" Required="true" ShowRedStar="true" Text=""></f:TextBox>
                                    <f:DatePicker runat="server" ID="IntoDate" Label="交机日"  Required="true" ShowRedStar="true"></f:DatePicker>
                                    <f:TextBox runat="server" ID="IntoAddress" Label="地点"   Required="true" ShowRedStar="true" Text=""></f:TextBox>
                                    <f:DatePicker runat="server" ID="FaultDate" Label="故障日"  Required="true" ShowRedStar="true"></f:DatePicker>
                                    <f:TextBox runat="server" ID="MachineType" Label="机型" Text=""  Required="true" ShowRedStar="true"></f:TextBox>
                                    <f:TextBox runat="server" ID="WorkHour" RegexPattern="NUMBER" Required="true" ShowRedStar="true" Label="工作小时" Text="0"></f:TextBox> 
                                    <f:TextBox runat="server" ID="ReportUser" Label="报告人" Text=""  Required="true" ShowRedStar="true"></f:TextBox>
                                    <f:TextBox runat="server" ID="ReportTel" Label="联系电话" Text=""  Required="true" ShowRedStar="true"></f:TextBox> 
                                    <f:TextBox runat="server" ID="DamagePartsNumber" Label="损坏部品序列号或钢号" Text="" TableColspan="2" ></f:TextBox>                                        
                                </Items>
                            </f:Panel>
                            <f:Panel runat="server" ID="Panel2" ShowBorder="false" ShowHeader="false" Layout="Table" TableConfigColumns="1"  >
                                <Items>
                                    <f:Label runat="server" ID="Label4" TableColspan="2" ShowLabel="false" Label="  "></f:Label>  
                                    <f:DropDownList ID="MacNature" runat="server" Label="机器性质" Required="true" DataValueField="RoleId" DataTextField="RoleName">
                                        <f:ListItem Value="代理商库存机" Text="代理商库存机" />
                                        <f:ListItem Value="IHISCE样机" Text="IHISCE样机" />
                                        <f:ListItem Value="终端客户机" Text="终端客户机" Selected="true" />
                                    </f:DropDownList>
                                    <f:DropDownList ID="IntoConditi" runat="server" Label="作业内容" Required="true" DataValueField="RoleId" DataTextField="RoleName">
                                        <f:ListItem Value="土方" Text="土方"  />
                                        <f:ListItem Value="砂石" Text="砂石" />
                                        <f:ListItem Value="采石" Text="采石" />
                                        <f:ListItem Value="挖砂" Text="挖砂" />
                                        <f:ListItem Value="造园" Text="造园" />
                                        <f:ListItem Value="其他" Text="其他" Selected="true"/>
                                    </f:DropDownList>
                                    <f:DropDownList ID="IntoSpecial" runat="server" Label="特别附件及规格" Required="true" DataValueField="RoleId" DataTextField="RoleName">
                                        <f:ListItem Value="破碎管路" Text="破碎管路" />
                                        <f:ListItem Value="破碎专用" Text="破碎专用" />
                                        <f:ListItem Value="加宽铲斗" Text="加宽铲斗" />
                                        <f:ListItem Value="加长臂" Text="加长臂" />
                                        <f:ListItem Value="其他" Text="其他" />
                                        <f:ListItem Value="标准规格" Text="标准规格" Selected="true" />
                                    </f:DropDownList>
                                </Items>
                            </f:Panel>
                            
                        </Items>
                    </f:Panel>
                    <f:Panel runat="server" ID="pnlGZInfo"   Title="2.故障信息" BodyPadding="5px" EnableCollapse="true" CssClass="mytable"  Layout="HBox" ShowHeader="true" ShowBorder="true">
                        <Items>
                          <f:Panel runat="server" ID="Panel3" ShowBorder="false" ShowHeader="false" Width="600px"  >
                                <Items>   
                                    <f:Label runat="server" ID="Label1" Text="故障描述(工况、故障部位、故障现象）："></f:Label>
                                    <f:HtmlEditor runat="server" ID="HEFaultDescription" Height="195px"  Width="515" ></f:HtmlEditor>
                                    <f:Label runat="server" ID="Label2" Text="故障推定原因："></f:Label>
                                    <f:HtmlEditor runat="server" ID="HEFaultReason" Height="195px"  Width="515"></f:HtmlEditor>
                                    <f:Label runat="server" ID="Label3" Text="结论："></f:Label>
                                    <f:HtmlEditor runat="server" ID="HEProcessMode" Height="195px"  Width="515"></f:HtmlEditor>
                                </Items>
                        </f:Panel> 
                        <f:Panel runat="server" ID="Panel4" ShowBorder="false" ShowHeader="false" Layout="Table"   Width="420px"  TableConfigColumns="2" >
                            <Items>                                
                                <f:Label runat="server" TableColspan="2" Text="照片或绘图说明:"></f:Label>
                                <f:ContentPanel runat="server" ShowBorder="false" ShowHeader="false"  TableColspan="1" Width="220px" Height="210px">
                                    <img id="imgRelatively1" name="imgRelatively" src="/res/blank.png"  Width="200" Height="150"/>
                                    <input type="file" name="filedata" id="imgRelativelyupload1" uploadify="uploadify" clientId="imgRelatively1" onUploadSuccess="onAgentQltyUploadImgSuccess"/>
                                    <input type="text" name="ImgTitle" value="图1:铭牌" />                                    
                                </f:ContentPanel>
                                <f:ContentPanel runat="server" ShowBorder="false" ShowHeader="false"  TableColspan="1" Width="200px" Height="210px">
                                    <img id="imgRelatively2" name="imgRelatively" src="/res/blank.png"  Width="200" Height="150"/>
                                    <input type="file" name="filedata" id="imgRelativelyupload2" uploadify="uploadify" clientId="imgRelatively2" onUploadSuccess="onAgentQltyUploadImgSuccess"/>
                                    <input type="text" name="ImgTitle" value="图2:工作小时" />                                    
                                </f:ContentPanel>
                                <f:ContentPanel runat="server" ShowBorder="false" ShowHeader="false"  TableColspan="1" Height="210px">
                                    <img id="imgRelatively3" name="imgRelatively" src="/res/blank.png"  Width="200" Height="150"/>
                                    <input type="file" name="filedata" id="imgRelativelyupload3" uploadify="uploadify" clientId="imgRelatively3" onUploadSuccess="onAgentQltyUploadImgSuccess"/>
                                    <input type="text" name="ImgTitle" value="图3:故障图片" />                                    
                                </f:ContentPanel>
                                 <f:ContentPanel runat="server" ShowBorder="false" ShowHeader="false"  TableColspan="1" Height="210px">
                                    <img id="imgRelatively4" name="imgRelatively" src="/res/blank.png"  Width="200" Height="150"/>
                                    <input type="file" name="filedata" id="imgRelativelyupload4" uploadify="uploadify" clientId="imgRelatively4" onUploadSuccess="onAgentQltyUploadImgSuccess"/>
                                    <input type="text" name="ImgTitle" value="图4:故障图片" />                                    
                                </f:ContentPanel>
                                <f:ContentPanel runat="server" ShowBorder="false" ShowHeader="false"  TableColspan="1" Height="210px">
                                    <img id="imgRelatively5" name="imgRelatively" src="/res/blank.png"  Width="200" Height="150"/>
                                    <input type="file" name="filedata" id="imgRelativelyupload5" uploadify="uploadify" clientId="imgRelatively5" onUploadSuccess="onAgentQltyUploadImgSuccess"/>
                                    <input type="text" name="ImgTitle" value="图5:故障图片" />                                    
                                </f:ContentPanel>
                                <f:ContentPanel runat="server" ShowBorder="false" ShowHeader="false"  TableColspan="1" Height="210px">
                                    <img id="imgRelatively6" name="imgRelatively" src="/res/blank.png"  Width="200" Height="150"/>
                                    <input type="file" name="filedata" id="imgRelativelyupload6" uploadify="uploadify" clientId="imgRelatively6" onUploadSuccess="onAgentQltyUploadImgSuccess"/>
                                    <input type="text" name="ImgTitle" value="图6:整机及工况图片" />                                    
                                </f:ContentPanel>
                                <f:ContentPanel runat="server" ShowBorder="false" ShowHeader="false"  TableColspan="2" Height="45px">
                                    <div style="margin-top:5px;"></div>
                                    其它文件上传(不能超过10M)<br/>
                                    <input type="hidden" name="imgRelatively" id="imgRelativelyupload7" />
                                    <input type="file" name="filedata" id="imgRelativelyupload7" uploadify="uploadify" clientId="imgRelatively7" onUploadSuccess="onAgentQltyUploadFileSuccess"/>
                                </f:ContentPanel>
                                <%--<f:Image ID="imgRelatively1" CssClass="imgthumb" ImageUrl="~/res/blank.png" ShowEmptyLabel="false" runat="server" ImageWidth="200" ImageHeight="150"></f:Image>
                                <f:Image ID="imgRelatively2" CssClass="imgthumb" ImageUrl="~/res/blank.png" ShowEmptyLabel="false" runat="server"  ImageWidth="200" ImageHeight="150"></f:Image>
                                <f:FileUpload runat="server" ID="filePhoto1"  ShowEmptyLabel="false" ButtonOnly="true" ButtonText="图片上传"  ButtonIcon="ImageAdd" AutoPostBack="true" OnFileSelected="filePhoto1_FileSelected" EmptyText="1" ></f:FileUpload>
                                <f:FileUpload runat="server" ID="filePhoto2"  ShowEmptyLabel="false" ButtonOnly="true" ButtonText="图片上传"  ButtonIcon="ImageAdd" AutoPostBack="true" OnFileSelected="filePhoto1_FileSelected" EmptyText="2" ></f:FileUpload>
                                <f:TextBox runat="server"  Label="" ID="ImgTitle1" Required="true" ShowRedStar="true" Text="图1:铭牌"></f:TextBox>
                                <f:TextBox runat="server" Label="" ID="ImgTitle2" Required="true" ShowRedStar="true" Text="图2:工作小时"></f:TextBox>

                                <f:Image ID="imgRelatively3" CssClass="photo" ImageUrl="~/res/blank.png" ShowEmptyLabel="false" runat="server" ImageWidth="200" ImageHeight="150"></f:Image>
                                <f:Image ID="imgRelatively4" CssClass="photo" ImageUrl="~/res/blank.png" ShowEmptyLabel="false" runat="server" ImageWidth="200" ImageHeight="150"></f:Image>
                                <f:FileUpload runat="server" ID="filePhoto3"  ShowEmptyLabel="false" ButtonOnly="true" ButtonText="图片上传"   ButtonIcon="ImageAdd" AutoPostBack="true" OnFileSelected="filePhoto1_FileSelected" EmptyText="3"></f:FileUpload>
                                <f:FileUpload runat="server" ID="filePhoto4"  ShowEmptyLabel="false" ButtonOnly="true" ButtonText="图片上传"   ButtonIcon="ImageAdd" AutoPostBack="true" OnFileSelected="filePhoto1_FileSelected" EmptyText="4"></f:FileUpload>
                                <f:TextBox runat="server" Label="" ID="ImgTitle3" Required="true" ShowRedStar="true" Text="图3:故障图片"></f:TextBox>
                                <f:TextBox runat="server" Label="" ID="ImgTitle4" Required="true" ShowRedStar="true" Text="图4:故障图片"></f:TextBox>

                                <f:Image ID="imgRelatively5" CssClass="photo" ImageUrl="~/res/blank.png" ShowEmptyLabel="false" runat="server" ImageWidth="200" ImageHeight="150"></f:Image>
                                <f:Image ID="imgRelatively6" CssClass="photo" ImageUrl="~/res/blank.png" ShowEmptyLabel="false" runat="server" ImageWidth="200" ImageHeight="150"></f:Image>
                                <f:FileUpload runat="server" ID="filePhoto5"  ShowEmptyLabel="false" ButtonOnly="true" ButtonText="图片上传"   ButtonIcon="ImageAdd" AutoPostBack="true" OnFileSelected="filePhoto1_FileSelected" EmptyText="5"></f:FileUpload>
                                <f:FileUpload runat="server" ID="filePhoto6"  ShowEmptyLabel="false" ButtonOnly="true" ButtonText="图片上传"   ButtonIcon="ImageAdd" AutoPostBack="true" OnFileSelected="filePhoto1_FileSelected" EmptyText="6"></f:FileUpload>
                                <f:TextBox runat="server" Label="" ID="ImgTitle5" Required="true" ShowRedStar="true" Text="图5:故障图片"></f:TextBox>
                                <f:TextBox runat="server" Label="" ID="ImgTitle6" Required="true" ShowRedStar="true" Text="图6:整机及工况图片"></f:TextBox>
                                
                                <f:Label runat="server" TableColspan="2" Text="其它文件上传(不能超过10M)"></f:Label>
                                 <f:FileUpload runat="server" ID="fileOther"  ShowEmptyLabel="false" ButtonOnly="true" ButtonText="其它文件上传" ShowLabel="false"   ButtonIcon="Add" AutoPostBack="true" EnableAjax="false" OnFileSelected="fileOther_FileSelected" EmptyText="7"></f:FileUpload>
                                 --%>
                            </Items>                          
                         </f:Panel>
                        </Items>
                    </f:Panel>
                   <f:Panel runat="server" ID="Panel5"   Title="3.部品需求(只有填写配件号的行才会被保存)" BodyPadding="0px" EnableCollapse="true" Layout="Fit" ShowHeader="true" ShowBorder="true" Height="600px" AutoScroll="true" >
                         <Items>
                             <f:Grid runat="server" ID="grdAgentQltyParts" ShowHeader="false" ShowBorder="false" >
                                 <Columns>
                                     <f:RowNumberField Width="50px" TextAlign="Center" />
                                     <f:TemplateField HeaderText="配件号" Width="200px" EnableColumnHide="false" EnableHeaderMenu="false" >
                                         <ItemTemplate>
                                             <asp:TextBox runat="server"  ID="tbItemCode" CssClass="ItemCode"  Text=""></asp:TextBox>
                                          </ItemTemplate>
                                     </f:TemplateField>
                                     <f:TemplateField HeaderText="配件名" Width="250px" EnableColumnHide="false" EnableHeaderMenu="false">
                                         <ItemTemplate>
                                               <asp:TextBox runat="server"  ID="tbDscription" CssClass="tbDscription"  Text=""></asp:TextBox>
                                         </ItemTemplate>
                                     </f:TemplateField>
                                     <f:TemplateField HeaderText="数量" Width="150px" EnableColumnHide="false" EnableHeaderMenu="false">
                                         <ItemTemplate>
                                              <f:TextBox runat="server" Label="" ID="Quantity"  CssClass="Quantity" Text="1"></f:TextBox>
                                         </ItemTemplate>
                                     </f:TemplateField>
                                     <f:TemplateField HeaderText="配件需求" Width="150px" EnableColumnHide="false" EnableHeaderMenu="false">
                                         <ItemTemplate>
                                            <asp:DropDownList runat="server" ID="ddlPartsDemand">
                                                <asp:ListItem Value="索赔结算" Text="索赔结算" ></asp:ListItem>
                                                <asp:ListItem Value="索赔发货" Text="索赔发货" Selected="True"></asp:ListItem>
                                            </asp:DropDownList>
                                         </ItemTemplate>
                                     </f:TemplateField>
                                 </Columns>
                             </f:Grid>
                         </Items>
                    </f:Panel>
                </Items>
            </f:Form>
        </Items>
    </f:Panel>
    <f:Window ID="ViewImgWindow" Title="查看图片" Hidden="true" EnableIFrame="true" runat="server"
        EnableMaximize="true" EnableResize="true" Target="Top" IsModal="True" Width="750px"
        Height="500px">
    </f:Window>
    </form>  
     
<%--    <script src="../res/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="../res/js/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
     <script type="text/javascript">
         F.ready(function () {
             $(".ItemCode").each(function () {
                 $(this).autocomplete({
                        source: function (request, response) {
                            $.ajax({
                                url: "<%=AgentAutoCompleteUrl%>?ajaxmethod=getoitmlist",
                                dataType: "json",
                                data: {
                                    limit: 10,
                                    key: request.term
                                },
                                success: function (data) {
                                    response($.map(data.citylist, function (item) {
                                        return { itemcode: item.itemcode, itemname: item.itemname }
                                    }));
                                }
                            });
                        },
                        select: function (event, ui) {
                            var $this = $(this);
                            $this.val(ui.item.itemcode);
                            $this.closest("tr").find(".tbDscription").val(ui.item.itemname);
                            return false;
                        },
                        minLength: 1,
                        autoFocus: true,
                        delay: 100
                    }).data("autocomplete")._renderItem = function (ul, item) {
                        return $("<li>").data("item.autocomplete", item)
                        .append("<a><span class='autocomplete-item-title'>" + item.itemcode + "</span><br/>" + item.itemname + "</a>")
                        .appendTo(ul);
                    };
             })
          
             $(".mytable").find("img").each(function () {
                 $(this).click(function () {
                     F("ViewImgWindow").f_show($(this).attr("src"), "查看图片");
                 });
             })           
           

         });
    </script>--%>

    <script src="../res/js/jquery-1.4.4.min.js" type="text/javascript"></script>
    <link href="/MachineSys/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <script src="/MachineSys/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
    <script>
        F.ready(function () {
            $(":file[uploadify]").each(function () {

                var $this = $(this);               

                var options = {
                    buttonText: "",
                    fileTypeDesc: $this.attr("fileTypeDesc"),
                    fileTypeExts: $this.attr("fileTypeExts"),
                    uploader: "/MachineSys/uploadify/singupload.aspx",
                    'swf': "/MachineSys/uploadify/uploadify.swf",
                    'itemTemplate': '<div id="${fileID}" class="uploadify-queue-item"><div class="cancel"><a href="javascript:$(\'#${instanceID}\').uploadify(\'cancel\', \'${fileID}\')">X</a></div><span class="fileName">${fileName} (${fileSize})</span><span class="data"></span></div>',
                    'formData': { 'clientId': $this.attr("clientId") == undefined ? $this.attr("id") : $this.attr("clientId"),'dirtype':'4' }
                };

                if ($this.attr("onUploadSuccess")) {
                    options.onUploadSuccess = eval($this.attr("onUploadSuccess"));
                }

                $this.uploadify(options);
            });
        })
        function onAgentQltyUploadImgSuccess(file, data, response) {
            if (!response)
                return false;
            var restults = data.split("|");
            var $imgUploadPath = restults[0];
            var $trageId = restults[1];
            alert($trageId)
            $("#" + $trageId).attr("src",$imgUploadPath);
        }
        function onAgentQltyUploadFileSuccess(file, data, response)
        {
            if (!response)
                return false;
            var restults = data.split("|");
            var $imgUploadPath = restults[0];
            var $trageId = restults[1];
            alert($trageId)
            $("#" + $trageId).val($imgUploadPath);
        }
    </script>
</body>
</html>
